init()

function init()
{
    // proxyHook();
    // vpnHook();

    Java.perform(function()
    {
       var imports =  Module.enumerateRanges()
       console.log(JSON.stringify(imports))


    });
};

function proxyHook()
{
    Java.perform(function()
    {
        var sys = Java.use("java.lang.System")
        sys.getProperty.overload("java.lang.String").implementation = function (str)
        {
            if (str == "http.proxyHost")
            {
                return null;
            }
            else if(str =="http.proxyPort")
            {
                return null;
            }
            return sys.getProperty();
        }
        sys.getProperty.overload("java.lang.String","java.lang.String").implementation = function (str,str2)
        {
            var ret = this.getProperty(str,str2);
            console.log(ret)
            return ret;
        }
    });
}

function vpnHook()
{
   Java.perform(function()
    {
        send("java.net.NetworkInterface")
        var net = Java.use("java.net.NetworkInterface")
        net.getName.implementation = function ()
        {
            var ret = this.getName();
            if (ret == "tun0" || ret =="ppp0")
            {
                ret ="dummy9"
            }
            return ret;
        }
    });
}

function get_stack()
{
    var ex = Java.use("java.lang.Throwable").$new();
    var stack_elements = ex.getStackTrace();
    var json_ary = null;
    if (null != stack_elements && stack_elements.length > 0)
    {
        json_ary = new_json_array();
        for (var i = 1; i < stack_elements.length; i++)
        {
            json_ary.put(stack_elements[i].getClassName());
        }
    }

    return json_ary;
}

function get_time()
{
    return Java.use("java.lang.String").$new().valueOf(Java.use("java.lang.System").currentTimeMillis());
}